Lambdas
Blocs d'execution qui se manipulent en tant que variables:
val add: (Int, Int) -> Int = { a, b -> a + b }
add(1, 2)
fun applyToSelf(number: Int, operation: (Int, Int) -> Int) {
operation(number, number)
}
applyToSelf(4, add)
applyToSelf(3) { a, b -> a - b }
button.setOnClickListener { view -> ... }